package com.lalifa.googledate.ui.activity

import android.text.Html
import com.drake.net.utils.scopeNet
import com.lalifa.base.BaseTitleActivity
import com.lalifa.extension.getIntentString
import com.lalifa.extension.pk
import com.lalifa.extension.start
import com.lalifa.googledate.R
import com.lalifa.googledate.api.zcApi
import com.lalifa.googledate.databinding.ActivityWebBinding

class WebActivity : BaseTitleActivity<ActivityWebBinding>() {
    override fun getViewBinding() = ActivityWebBinding.inflate(layoutInflater)

    override fun initView() {
        val pk = getIntentString("title").pk()
        setTitle(pk)
        getProgress(this)
        scopeNet {
            val zcApi = zcApi()
            if(pk == getString(R.string.user_agree)){
                binding.info.text = Html.fromHtml(zcApi.data!!.policy.pk(), null, null)
            }else{
                binding.info.text = Html.fromHtml(zcApi.data!!.protocol.pk(), null, null)
            }
            hindProgress()
        }

    }
}